import { useState } from 'react'
import {useRequest} from 'ahooks'
import reactLogo from './assets/react.svg'
import { getUsername } from './api/request'
import './App.css'
// 请求数据  经常出现的 ahooks 
// data
// loading 
// error
function App() {
  const {data:username,error,loading} = useRequest(getUsername)
  if(error) return <div>failed to load</div>
  if(loading) return <div>loading...</div>
  return (
    <div className="App">
      username:{username}
    </div>
  )
}

export default App
